package org.gcu.filestorage.configuration;


import org.jetbrains.annotations.NotNull;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class TokenCheckConfiguration implements WebMvcConfigurer {
    @Override
    public void addInterceptors(@NotNull InterceptorRegistry registry) {
        InterceptorRegistration interceptorRegistration = registry.addInterceptor(new TokenCheckInterceptor());
        interceptorRegistration.addPathPatterns("/querySpaceStatus"); // 查询空间状态
        interceptorRegistration.addPathPatterns("/queryAccountInfo"); // 查询账户信息
        interceptorRegistration.addPathPatterns("/queryAccountInfoByStatus"); // 根据账号状态，查询账户信息
        interceptorRegistration.addPathPatterns("/submitApply"); // 提交空间申请请求
        interceptorRegistration.addPathPatterns("/queryApplyRecord"); // 查询申请记录
        interceptorRegistration.addPathPatterns("/approveRegister"); // 审批注册申请
        interceptorRegistration.addPathPatterns("/rejectRegister"); // 拒绝注册申请
        interceptorRegistration.addPathPatterns("/approveApply"); // 审批容量申请
        interceptorRegistration.addPathPatterns("/rejectApply"); // 拒绝容量申请
        interceptorRegistration.addPathPatterns("/queryApplyRecordByStatus"); // 通过状态查询申请记录
        interceptorRegistration.addPathPatterns("/listAllFilePath"); // 列举所有的文件路径
        interceptorRegistration.addPathPatterns("/newFolder"); // 新建文件目录
        interceptorRegistration.addPathPatterns("/deleteFolder"); // 删除文件目录
        interceptorRegistration.addPathPatterns("/querySpaceStatus"); // 查询空间状态
    }
}
